-
Notifications
You must be signed in to change notification settings - Fork 633
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[virtio][9p] Add VirtIO 9p device driver #399
Conversation
e55d0c8
to
b18095d
Compare
This commit adds the VirtIO 9p device driver based on the VirtIO driver stack in LK, `dev/virtio`. The driver supports a subset of 9P2000.L protocol (https://github.com/chaos/diod/blob/master/protocol.md), which is able to perform basic file operations (fread, fwrite, dirread, etc.). The primary interface for sending and receiving the 9p messages is `virtio_9p_rpc`, which is handy and scalable. The driver is limited to communicate to the host with only one outstanding 9p message per device due to the simplified driver design. Basically that is enough for embedded environments when there is no massive file IO. Signed-off-by: Cody Wong <[email protected]>
a60edfb
to
6f21ef5
Compare
Add a simple test to validate basic functionalities of the VirtIO 9p device driver, `dev/virtio/9p`. For now the test attaches to the first v9p device and try to read the file `LICENSE` under the shared folder. Therefore, if you set the shared folder to the git root of `lk`, it will read the `LICENSE` of the littlekernel and dump it to the console after running `v9p_tests`. For example: ``` starting internet servers starting app shell entering main console loop ] v9p_tests 0x80013c08: 2f 2a 0a 20 2a 20 43 6f 70 79 72 69 67 68 74 20 |/*. * Copyright 0x80013c18: 28 63 29 20 32 30 30 38 2d 32 30 31 35 20 54 72 |(c) 2008-2015 Tr 0x80013c28: 61 76 69 73 20 47 65 69 73 65 6c 62 72 65 63 68 |avis Geiselbrech 0x80013c38: 74 0a 20 2a 0a 20 2a 20 50 65 72 6d 69 73 73 69 |t. *. * Permissi 0x80013c48: 6f 6e 20 69 73 20 68 65 72 65 62 79 20 67 72 61 |on is hereby gra ... ``` Signed-off-by: Cody Wong <[email protected]>
- Add the v9p support for arm platform. - Add an option `-f` to set the shared directory on the host machine to `do-qemuarm`. - For example, to use the v9p dir sharing, run the script as: ``` # under `lk/` run the follow command will share the current # directory `lk/` within LK vm as VirtIO 9p device scripts/do-qemuarm -f . ``` Signed-off-by: Cody Wong <[email protected]>
Hi @travisg, I just want to make sure that you didn't miss the PRs. Please let me know if you have any ideas. |
KK! will take a look shortly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks pretty good. simple, but functional.
sorry for taking a long time, kept putting it off, but it's a good starter. The use of the bio device is a bit fishy, but i think in general moving this to some sort of actual fs, albeit limited, would work well. |
Really appreciated the effort and time. 🙏 I will keep working on integrating the virtual 9P with the fs library to make it support fs operations. |
Sounds good. I'm actually working on right now revamping the virtio bits to
work over PCI as well, so it may impact some of the driver. I'll try to
keep it minimum, but the interface to the virtio bus bits may change a bit
as it gets more abstracted.
|
Hi @travisg,
As we discussed in #398, I uploaded the commits to support VirtIO 9p devices. I tested it with arm platform and it worked just fine. I let it attach the
lk/
directory as the shared dir and read theLICENSE
file. Please see the log bellow:I will continue the file system integration with the 9p driver based on
lib/fs
. Please let me know if you have any questions!Thank you for your helps.